package model;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 节点信息模型
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class NodeInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 节点主机名或IP地址
     */
    private String host;

    /**
     * 节点端口号
     */
    private int port;

    /**
     * 节点角色
     */
    private NodeRole role;

    /**
     * 节点ID
     */
    private String nodeId;

    public NodeInfo(String host, int port) {
        this.host = host;
        this.port = port;
        this.nodeId = host + ":" + port;
    }

    @Override
    public String toString() {
        return nodeId;
    }
} 